The Tab View Component > FTabView.setLabelField()

 

FTabView.setLabelField()

Availability

Flash Player 6.

Usage

myTab_tbv.setLabelField (field)

Parameters

field A string that specifies the name of the field that will be used to define the label of the tab.

Returns


Nothing

Description

Specifies the name of the field that will be used to define the label of the tab. This allows you to pass DataProviders directly to the component and specify which field should be used for the label name. The default value is "label".

 

Notes

The name of the property that contains the name of the tab can be changed using the setLabelField method. The default value is "label".

 

Example

The tab_addListener.fla example file contains an example of using this method.

The following code creates a data provider with two properties, firstName and lastName. It then creates tabs based on the data provider, and uses setLabelField to map the firstName properties to be used as the label for the tab.

var dp = new Array();
dp.push({firstName:"Homer", lastName:"Simpson"});
dp.push({firstName:"Bart", lastName:"Simpson"});
dp.push({firstName:"Maggie", lastName:"Simpson"});

trace(myTab_tbv.getLabelField());//traces label

myTab_tbv.setLabelField("firstName");
myTab_tbv.setDataProvider(dp);
trace(myTab_tbv.getLabelField());//traces firstName

 

See also

FTabView.getDataProvider()

FTabView.getItemAt()

FTabView.getLabelField()